import {TableColumns} from '@/components/layout/table/table-columns';
import {FORMAT, FORMAT_DATETIME} from '@/utils/enums/type-enums';

/**
 * 设备列表
 */
export const deviceColumns: TableColumns[] = [
  {
    type: 'number',
    label: '序号',
    align: 'center',
    name: 'number',
  },
  {
    label: '设备名称',
    align: 'center',
    name: 'deviceName',
    width: 200
  },
  {
    label: '设备编码',
    align: 'center',
    name: 'deviceCode',
    width: 200
  },
  {
    label: 'SN编码',
    align: 'center',
    name: 'sn',
    width: 200
  },
  {
    label: '设备归属',
    align: 'center',
    name: 'organizationName',
    width: 300
  },
  {
    label: '设备类型',
    align: 'center',
    name: 'constName',
    width: 100,
  },
  {
    type: 'format',
    label: '生命周期状态',
    align: 'center',
    name: 'status',
    width: 120,
    value: [
      {label: '未开通', value: 0},
      {label: '已开通', value: 1},
      {label: '已停用', value: 2},
      {label: '已回收', value: 3},
      {label: '已报废', value: 4}
    ]
  },
  {
    type: 'format',
    label: '在离线状态',
    align: 'center',
    name: 'deviceStatus',
    value: [{label: '在线', value: 0}, {label: '离线', value: 1}]
  },
  {
    type: 'format',
    label: '当前状态',
    align: 'center',
    name: 'bindStatus',
    value: [{label: '未绑定', value: 0}, {label: '已绑定', value: 1}]
  },
  {
    type: FORMAT_DATETIME,
    label: '最后上线时间',
    align: 'center',
    name: 'lastRegisterTime',
    formatter: 'YYYY-MM-DD HH:mm:ss',
    width: 160
  },
  {
    type: FORMAT_DATETIME,
    label: '最后通讯时间',
    align: 'center',
    name: 'lastDataTime',
    formatter: 'YYYY-MM-DD HH:mm:ss',
    width: 160
  },
  {
    type: FORMAT_DATETIME,
    label: '创建时间',
    align: 'center',
    formatter: 'YYYY-MM-DD HH:mm:ss',
    name: 'addTime',
    width: 160
  },
  {
    label: '操作',
    type: 'custom',
    align: 'center',
    fixed: 'right',
    width: 350,
    buttons: [
      {method: 'see', text: '查看'},
      {method: 'edit', text: '编辑'},
      {method: 'circulation', text: '设备流转'},
      {method: 'history', text: '历史数据'},
      {method: 'record', text: '添加记录'}
    ]
  },
]

/**
 * 设备维修记录表
 */
export const deviceRepairColumns: TableColumns[] = [
  {
    type: FORMAT_DATETIME,
    label: '维修开始时间',
    name: 'addTime',
    width: 200,
    formatter: 'YYYY-MM-DD'
  },
  {
    type: FORMAT_DATETIME,
    label: '维修结束时间',
    name: 'editTime',
    width: 200,
    formatter: 'YYYY-MM-DD'
  },
  {
    label: '维修单',
    name: 'repairDoc',
    width: 200
  },
  {
    label: '备注',
    name: 'remark',
    width: 300
  }
]
/**
 * 设备报废记录表
 */
export const deviceScrapColumns: TableColumns[] = [
  {
    type: FORMAT_DATETIME,
    label: '报废开始时间',
    name: 'addTime',
    width: 200,
    formatter: 'YYYY-MM-DD'
  },
  {
    label: '检修报告',
    name: 'repairDoc',
    width: 200
  }
]
/**
 * 设备流转记录表
 */
export const deviceReplaceColumns: TableColumns[] = [
  {
    label: '原机构名称',
    name: 'sourceOrganizationName',
    width: 200
  },
  {
    label: '目标机构名称',
    name: 'targetOrganizationName',
    width: 200
  },
  {
    label: '备注',
    name: 'remark',
    width: 300
  },
  {
    type: FORMAT_DATETIME,
    label: '记录时间',
    name: 'addTime',
    width: 200,
    formatter: 'YYYY-MM-DD HH:mm:ss'
  },
  {
    label: '操作人',
    name: 'addUserName',
    width: 200
  }
]

export const historyColumns: TableColumns[] = [
  // {
  //   type: FORMAT,
  //   label: '设备类型',
  //   name: 'messageType',
  //   width: 100,
  //   value: [
  //     {value: 'mattress', label: '床垫'},
  //     {value: 'burglar_alarm', label: '拉绳'},
  //     {value: 'flood', label: '水侵'},
  //     {value: 'gas', label: '燃气'},
  //     {value: 'smoke', label: '烟雾'},
  //     {value: 'infrared', label: '红外'},
  //     {value: 'gate_magnetism', label: '门磁'},
  //     {value: 'nb_watch', label: '手环'},
  //     {value: 'four_g_watch', label: '手环'},,
  //     {value: 'bracelet', label: '手环'},
  //     {value: 'nbiot_alarm', label: '拉绳'},
  //     {value: 'nbiot_flood', label: '水侵'},
  //     {value: 'nbiot_gas', label: '燃气'},
  //     {value: 'nbiot_smoke', label: '烟雾'}
  //   ]
  // },
  {
    label: '消息类型',
    name: 'messageType',
    width: 80
  },
  {
    type: FORMAT,
    label: '上/下行',
    name: 'dataType',
    width: 80,
    value: [{value: 1, label: '上行'}, {value: 0, label: '下行'}]
  },
  {
    type: FORMAT_DATETIME,
    label: '消息时间',
    name: 'dataTime',
    width: 160,
    formatter: 'YYYY-MM-DD HH:mm:ss'
  },
  {
    label: '接收方',
    name: 'to',
    width: 150
  },
  {
    label: '发送方',
    name: 'from',
    width: 150
  },
  {
    label: '版本',
    name: 'version',
    width: 100
  },
  {
    label: '消息内容',
    name: 'body',
    width: 800
  }
]